

//class Person {
//    private String my_Name;
//    private int my_Age;
//    public static String classRoom;
//    public Person(){
////        this("zhangsan", 50);
//    }
//    public Person(String name, int age) {
//        this.my_Name = name;
//        this.my_Age = age;
//        System.out.println("String,int-----");
//    }
//    static{
//        classRoom = "bit113";
//        System.out.println("这是一个静态代码块！");
//    }
//    {
//        System.out.println("这是一个构造块！");
//    }
//    public void Sleep(){
//        System.out.println("姓名："+ my_Name + "在睡觉！" + "年龄是：" + my_Age);
//    }
//
//    //打印对像
//    @Override
//    public String toString() {
//        return "Person{" +
//                "my_Name='" + my_Name + "\'" +
//                ", my_Age=" + my_Age +
//                '}';
//    }
//
//    //返回打印一个名字
//    public String getMy_Name() {
//        return my_Name;
//    }
//
//    //读取一个名字
//    public void setMy_Name(String name) {
//        this.my_Name = name;
//    }
//}
//
//
//public class test {
//    public static void main(String[] args) {
//        //Person person1 = new Person("zhangsan", 20);
//        //Person person2 = new Person("ssdadad", 15);
//        //String ret = Person.classRoom;
////        Person person3 = new Person("BLACKPINK", 21);
////        person3.Sleep();
////        System.out.println(person3.toString());
//        Person person4 = new Person();
//        person4.setMy_Name("sadadada");
//        System.out.println(person4.getMy_Name());
//
//    }
//}
import java.util.Scanner;
public class test {

    public static void move(String a1, String a2) {
        System.out.print(a1 + "-->" + a2 + " ");
    }
    public static void hanio(String pos1,String pos2, String pos3, int n) {
        if(n == 1) {
            move(pos1, pos3);
        }else {
            hanio(pos1, pos3, pos2, n - 1);
            move(pos1, pos3);
            hanio(pos2, pos1, pos3, n - 1);
        }
    }
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        /*
        * hanio
        * 参数1：起始位置
        * 参数2：中转位置
        * 参数3：最终位置
        */
        hanio("A", "B", "C", n);
    }

    //斐波那契数列
    public static int fib(int n) {
        if(n < 3) {
            return 1;
        }else {
            return fib(n - 1) + fib(n - 2);
        }
    }
    public static void main4(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int ret = fib(n);
        System.out.println(ret);
    }

//    求一个数的每一位之和
    public static int fib3(int n) {
        if(n != 0) {
            return n % 10 + fib3(n / 10);
        }else {
            return 0;
        }
    }
    public static void main3(String[] args) {
        System.out.println(fib3(555));
    }
    //1 + 2 + ... + 10 的和

    public static int fib2(int n) {
            if(n == 1){
                return 1;
            }else {
                return n + fib2(n - 1);
            }
    }
    public static void main2(String[] args) {
        System.out.println(fib2(10));
    }

    //求n的阶乘
    public static int fib1(int n) {
        if(n < 3) {
            return n;
        }else {
            return fib1(n - 1) * n;
        }
    }
    public static void main1(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();

        System.out.println(fib1(n));
    }
}